﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DB_NH.DB_Map.ywxt
{
    using NHibernate;
    using NHibernate.Mapping.ByCode;
    using NHibernate.Mapping.ByCode.Conformist;

    using DB_NH.DB_Model.ywxt;

    /// <summary>
    /// 费用详细记录映射类
    /// </summary>
    class fy_detail_Map : ClassMapping<fy_detail>
    {
        public fy_detail_Map()
        {
            //映射ID
            Id(x => x.id, map => map.Length(40));

            Property(x => x.is_valid);
            Property(x => x.create_date);

            //费用所属部门
            ManyToOne(x => x.fy_department, map =>
            {
                map.Column(fy_detail.Columns.fy_dept_id);
                map.NotNullable(false);
            });

            Property(x => x.fy_describe, map =>
            {
                map.Column(fy_detail.Columns.fy_describe);
                map.Length(10000);
            });

            Property(x => x.fy_je, map =>
            {
                map.Column(fy_detail.Columns.fy_je);
            });
            Property(x => x.fy_lx, map =>
            {
                map.Column(fy_detail.Columns.fy_lx);
                map.Length(50);
            });

            //费用所属项目
            ManyToOne(x => x.fy_project, map =>
            {
                map.Column(fy_detail.Columns.fy_proj_id);
                map.NotNullable(false);
            });

            //费用所属报账流程记录
            ManyToOne(x => x.fybz, map =>
            {
                map.Column(fy_detail.Columns.fybz_id);
                map.NotNullable(false);
            });

            //费用所属费用类型
            ManyToOne(x => x.fylx, map =>
            {
                map.Column(fy_detail.Columns.fy_lx_id);
                map.NotNullable(false);
            });

            Property(x => x.fylxdm, map =>
            {
                map.Column(fy_detail.Columns.fy_type);
                map.Length(50);
            });

            Table(fy_detail.TableName);


            //SchemaAction(NHibernate.Mapping.ByCode.SchemaAction.None);
        }
    }
}
